package cn.edu.lingnan.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.edu.lingnan.dao.OrgDAO;
import cn.edu.lingnan.dto.Org;

public class OrgRegisterServlet extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String oid=req.getParameter("oid");
		String oname=req.getParameter("oname");
		Org o=new Org();
		o.setoId(oid);
		o.setoName(oname);
		OrgDAO od=new OrgDAO();
		int flag=od.insertInfoToOrg(o);
		System.out.println(flag);
		if(flag==1)
			resp.sendRedirect(req.getContextPath()+"/admin/admin.html");
		else
			resp.sendRedirect(req.getContextPath()+"/Orgregister.html");
	}
}
